package com.itheima.hashset;

import com.itheima.domain.Student;

import java.util.HashSet;

public class Demo02 {

    public static void main(String[] args) {
        HashSet<Student> set = new HashSet<>();
        Student wu = new Student("wuyifan", 31);
        //System.out.println(wu);
        System.out.println(wu.hashCode());
        Student wu2 = new Student("wuyifan", 31);
        //System.out.println(wu2);
        System.out.println(wu2.hashCode());
        //是两个对象  内容 相同

        Student huang = new Student("huangzitao", 31);
        Student lu = new Student("luhan", 30);
        Student zhang = new Student("zhangyixing", 31);
        set.add(wu);
        set.add(wu2);
        set.add(huang);
        set.add(lu);
        set.add(zhang);
        for (Student student : set) {
            System.out.println(student);
        }

    }
}
